import React,{FC} from "react";
import { Button, Card ,Input, Table,} from "antd"
const { Search } = Input;

interface IProps {
    /**
     * @description 表头
     */
     columns?: [];
    /**
     * @description 表格数据
     */
     data?:[];
    /**
     * @description 表格名称
     */
    name?: string;
    /**
     * @description 表格宽度
     */
    width?: string;
     /**
     * @description 增加按钮事件
     */
    addonClick?:(e:any)=>void;
  }

const MyList :FC<IProps>= ({
    columns,data,name,width="100%",addonClick
}) => {
   
    const onSearch = () => { }
    return (
        <>
            <Card title={name} style={{ width: "100%" }}>
                <div style={{ width: "100%", display: "flex" }}>
                    <Button type="primary" onClick={addonClick}>添加</Button>
                    <Search placeholder="搜索" onSearch={onSearch} style={{ width: "300px" }} enterButton />
                </div>
                <Table columns={columns} dataSource={data} style={{ overflow: "auto", width,height: "500px" }} sticky={true} />
            </Card>
        </>

    )
}


export default MyList